<?php
$html = file_get_contents('http://codescience.wordpress.com/2011/02/15/php-web-crawler/');
$dom_object = new DOMDocument();
@$dom_object->loadHTML($html);
$xpath_node = new DOMXPath($dom_object);
$hrefs_links = $xpath_node->evaluate("/html/body//a");
$name_array = array();
    
for ($count = 0; $count < $hrefs_links->length; $count++) {
    $href = $hrefs_links->item($count);
    $url_name = $href->getAttribute('href');
    echo $url_name.'<br />';
    $name_array[] = $url_name;
    
}
    
    
?>